package com.fifth.apartment.controller;

import com.fifth.apartment.common.SMScommon;
import com.fifth.apartment.result.Result;
import com.fifth.apartment.service.UserLoginService;
import com.fifth.apartment.utils.RandomUtil;
import com.fifth.apartment.vo.LoginVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * TODO
 *
 * @author Dao
 * @since 2024/7/13
 */
@RestController
@RequestMapping("/admin/login")
@Api(tags = "移动端登录接口")
@Slf4j
public class UserLoginController {

    @Autowired
    private UserLoginService service;

    @PostMapping("login")
    @ApiOperation("登录接口")
    public Result login(@RequestBody LoginVO vo){
        Result result = service.login(vo);

        return result;
    }



    @GetMapping("sendCode")
    @ApiOperation("登陆时发送验证码")
    public Result sendCode(String phone){
      Result result =service.sendCode(phone);
      return result;
    }
}
